<?php
class basicdata_network extends model
{
    
   public $id_network_teached;
   public $type;
   public $id_data_set;
   public $keyV;
   public $value1;
   public $value2;
   public $id_data_network;

	public static function loadModel($id=null, $join=null)
	{
		$obiekt = new Data_network($id, $join);
		if(!$obiekt ->isNull())
			return $obiekt;
		else return null;
	}
				
	public static function loadSpecialModel($where){
		$stmt = self::$db -> query("SELECT * FROM data_network WHERE $where LIMIT 1;");
		$row = $stmt -> fetch(PDO::FETCH_ASSOC);
		if(!$row)
			return self::loadModel();
		$model = self::loadModel();
		$model -> SetValues($row);
		$model -> NewRecord = false;
		return $model;
	}

	public static function getAll($where=null)
	{
		return model::getAll('Data_network', $where);
	}

	public function __construct($id=null, $join = null)
	{
		parent::__construct($id, $join);
		$this -> labels = array(
           
        );
	}

		
	public function getTableName()
	{
		return 'data_network';
	}

	public function getPrimaryKey()
	{
		return 'id_data_network';
	}

	public function getColumns()
	{
		return array('id_network_teached', 'type', 'id_data_set', 'keyV', 'value1', 'value2', 'id_data_network');
	}

	protected function getBoolColumns()
	{
		return array();
	}

	public function getRules($ignore=array())
	{
		$rules = array(
            'ValidRule-id_test-isInt' => new ValidRule('id_test', isInt, array(&$this->id_test)),
            'ValidRule-id_test-exists' => new ValidRule('id_test', exists, array(&$this->id_test)),
            'ValidRule-id_network_teached-isInt' => new ValidRule('id_network_teached', isInt, array(&$this->id_network_teached)),
            'ValidRule-id_network_teached-exists' => new ValidRule('id_network_teached', exists, array(&$this->id_network_teached)),
            'ValidRule-id_test_data-isInt' => new ValidRule('id_test_data', isInt, array(&$this->id_test_data)),
            'ValidRule-id_test_data-exists' => new ValidRule('id_test_data', exists, array(&$this->id_test_data)),
            'ValidRule-output-exists' => new ValidRule('output', exists, array(&$this->output))	
        );			

		if(!empty($ignore))
		{
			if(!is_array($ignore)) $ignore = array($ignore);
			foreach($ignore as $field)
			{
				unset($rules[$field]);
			}
		}
		return $rules;

	}

    protected function getJoinTables() {
        return array('Network_teached');
    }


}
?>